package com.sekill.goods.mq;

import com.rabbitmq.client.Channel;
import com.sekill.goods.service.ISeckillService;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Consumer {
    @Autowired
    private ISeckillService iSeckillService;

    @RabbitListener(queues = "queue_work2")
    public void receiveMessage(String msg, Channel channel, Message message) throws Exception {
        System.out.println(message);
        // 只包含发送的消息
        System.out.println("1接收到消息：" + msg);
        iSeckillService.ftlToHtml();
        iSeckillService.ftlToHtml(Integer.parseInt(msg));
    }
}
